package databases

import (
	config "golang-blog/conf"
	"log"

	"gorm.io/gorm"
)

func GetDB() *gorm.DB {
	var dbtype string
	if dbtype == "" {
		dbtype = config.Viper().GetString("db.type")
	}
	switch dbtype {
	case "mysql":
		return GetMysqlDB()
	case "sqlite":
		return GetSqliteDB()
	}
	log.Fatal("Unsupport DB:", dbtype)
	return nil
}
